import wepy from 'wepy'
const baseURL = 'https://uinav.com/api/public/v1'
wepy.baseToast = function (res, code, str) {
  if (res.meta.status !== (code || 200))
    return wepy.showToast({
      title: str || '获取数据失败',
      icon: 'none'
    })
}

wepy.get = function (url, data = {}) {
  return wepy.request({
    url: baseURL + url,
    method: 'GET',
    data
  })
}

wepy.post = function (url, data = {}) {
  return wepy.request({
    url: baseURL + url,
    method: 'POST',
    data
  })
}